Changing "attributes" in Doors user management

Dear All,

I'm completly new to DXL. I've a special problem.
I should change "attributes" of a lot of DOORS-users
like email-addresses, etc. Is this possible via DXL ?

Any code would be appreciated

Regards
Michi
Michi_79 - Thu May 26 03:41:35 EDT 2011

Re: Changing "attributes" in Doors user management
SystemAdmin - Thu May 26 08:49:10 EDT 2011

Below is a modifications for some code examples from DXL Help:
 

User u
 
for u in userList do 
{
    loadUserRecord(u)
    string n = u.name 
    string e = u.email 
    if (null e) 
      {
       u.email = n "@work.com"
      } 
    saveUserRecord (u) 
}
 
saveDirectory()

 


See the properties which you can read or modify in "Group and user management" section in DXL Help.

 

Re: Changing "attributes" in Doors user management
llandale - Fri May 27 15:25:21 EDT 2011

I'm guessing perhaps you want to change all email references from "xxx@OldCompany.com" to "xxx@NewCompany.com". If so, this is your lucky day because I did just that recently:

//string    From = "ngc.com",
//              To   = "hii-ingals.com"
string  From = "hii-ingals.com",
        To   = "hii-ingalls.com"
 
int     LenFrom = length(From),
        LenTo   = length(To)
 
 
void    ChangeUserEmail(User usr)
{
        string  EmailCurr = usr.email
        int     Len   = length(EmailCurr)
        string  Suffix, EmailNew
 
        if (Len >= LenFrom) //
        then { EmailNew = EmailCurr[0:Len-(LenFrom+1)] To
               Suffix   = EmailCurr[Len-LenFrom:]
             }
        else { EmailNew = ""
               Suffix   = ""
             }
        string  Name = usr.name
 
        print Name "\t" (Suffix == From) "\t<">\t[" EmailCurr "]\t[" EmailNew "]\n"
        if (Suffix == From)
        {  usr.email = EmailNew
        }
}
 
 
User    usr
for usr in userList do
{  ChangeUserEmail(usr)
}
saveDirectory()


You would modify your "From" and "To" variables at the top.

I don't understand when you would "saveUserRecord(usr)" after modifying a user vis-a-vis using "saveDirectory()" afterwards. Both seem to work.

 

 

  • Louie